const numberPageListApi = (params: any) => {
    return got({
        url: "/auth-api/num/list/page",
        method: "get",
        params: params
    });
};

const maxNumberApi = () => {
    return got({
        url: "/auth-api/num/max",
        method: "get"
    });
};

const batchAddNumbersApi = (data: any) => {
    return got({
        url: "/auth-api/num/add/batch",
        method: "post",
        data
    });
};

/**
 * 获取卖家已分配的杆号
 * @param sellerId 卖家ID
 */
const assignedNumbersApi = (sellerId: string | number) => {
    return got({
        url: "/auth-api/num/list/assigned",
        method: "get",
        params: { sellerId }
    });
};

/**
 * 获取未分配的杆号
 */
const availableNumbersApi = () => {
    return got({
        url: "/auth-api/num/list/available"
    });
};

/**
 * 批量分配杆号
 * @param sellerId 卖家ID
 * @param adds 分配的杆号列表
 * @param rems 移除的杆号列表
 */
const batchAssignApi = (sellerId: string | number, adds: number[], rems: number[]) => {
    return got({
        url: "/auth-api/num/assign",
        method: "post",
        data: {
            sellerId,
            adds,
            rems
        }
    });
};

export const numberClient = {
    numberPageListApi,
    maxNumberApi,
    batchAddNumbersApi,
    assignedNumbersApi,
    availableNumbersApi,
    batchAssignApi
};
